#!/usr/bin/env python3
# encoding: utf-8
"""
@author: kevin
@contact: evil365@gmail.com
@project : flask
@file: census_controller.py
@time: 2020/8/12 10:56
@license: (C) Copyright 2019-2025, Corporation Limited.
@desc:
"""
from flask import jsonify
from lin.redprint import Redprint

from .census import census, cen_pro

cen_api = Redprint('poem')


@cen_api.route('/cen', methods=['GET'])
def get_census():
    res = census.get_census()
    return jsonify(res)


@cen_api.route('/td', methods=['GET'])
def get_today_date():
    res = census.get_today_data()
    return jsonify(res)


@cen_api.route('/last', methods=["GET"])
def get_last_pro():
    res = cen_pro.get_last_product()
    return jsonify(res)


@cen_api.route('/chart', methods=["GET"])
def get_chart_data():
    result = census.get_cens_posion_chart()
    return jsonify(result)